home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Games / Solitaire / Sources / Klondike / KlondikePrefs.m < prev    next >
Text File  |  1994-01-08  |  2KB  |  78 lines

  1. /* indent:4  tabsize:8  font:fixed-width */
  2.  
  3. #import "KlondikePrefs.h"
  4.  
  5. @implementation KlondikePrefs
  6.  
  7.  
  8. /*---------------------------------------------------------------------------
  9. |
  10. |    - registerPrefs
  11. |
  12. |    returns: (id) self
  13. |
  14. |----------------------------------------------------------------------------
  15. |
  16. |    Register the preferences for this game.  Called automatically.
  17. |            
  18. \---------------------------------------------------------------------------*/
  19.  
  20. - registerPrefs
  21. {
  22.     const NXDefaultsVector gameDefaults =
  23.     {
  24.         {"CardsToDraw", "3"},
  25.         {NULL, NULL}
  26.     };
  27.  
  28.     NXRegisterDefaults(gameName, gameDefaults);
  29.  
  30.     cardsToDraw = atoi(NXGetDefaultValue(gameName, "CardsToDraw"));
  31.     [cardsToDrawMatrix selectCellWithTag:cardsToDraw];
  32.  
  33.     return self;
  34. }
  35.  
  36. /*---------------------------------------------------------------------------
  37. |
  38. |    - saveCardsToDraw:sender
  39. |
  40. |    returns: (id) self
  41. |
  42. |----------------------------------------------------------------------------
  43. |
  44. |    Save "CardsToDraw" preference.
  45. |            
  46. \---------------------------------------------------------------------------*/
  47.  
  48. - saveCardsToDraw:sender
  49. {
  50.     char buffer[80];
  51.  
  52.     cardsToDraw = [cardsToDrawMatrix selectedTag];
  53.     sprintf(buffer, "%d", cardsToDraw);
  54.     NXWriteDefault(gameName, "CardsToDraw", buffer);
  55.     return self;
  56. }
  57.  
  58. /*---------------------------------------------------------------------------
  59. |
  60. |    - cardsToDraw:sender
  61. |
  62. |    returns: (int) number of cards to draw from stock
  63. |
  64. |----------------------------------------------------------------------------
  65. |
  66. |    Return "CardsToDraw" preference.
  67. |            
  68. \---------------------------------------------------------------------------*/
  69.  
  70. - (int)cardsToDraw
  71. {
  72.     return cardsToDraw;
  73. }
  74.  
  75.  
  76.  
  77. @end
  78.